{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"https://raw.githubusercontent.com/Qiskit/qiskit-tutorials/master/images/qiskit-heading.png\" alt=\"Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook\" width=\"500 px\" align=\"left\">"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## _*The Vaidman Detection Test: Interaction Free Measurement*_ \n",
    "\n",
    "The latest version of this notebook is available on https://github.com/Qiskit/qiskit-tutorial.\n",
    "\n",
    "***\n",
    "### Contributors\n",
    "Alex Breitweiser\n",
    "***\n",
    "### Qiskit Package Versions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'qiskit': '0.10.3',\n",
       " 'qiskit-terra': '0.8.1',\n",
       " 'qiskit-ignis': '0.1.1',\n",
       " 'qiskit-aer': '0.2.1',\n",
       " 'qiskit-ibmq-provider': '0.2.2',\n",
       " 'qiskit-aqua': '0.5.1'}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import qiskit\n",
    "qiskit.__qiskit_version__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "\n",
    "One surprising result of quantum mechanics is the ability to measure something without ever directly \"observing\" it. This interaction-free measurement cannot be reproduced in classical mechanics. The prototypical example is the [Elitzur–Vaidman Bomb Experiment](https://en.wikipedia.org/wiki/Elitzur%E2%80%93Vaidman_bomb_tester) - in which one wants to test whether bombs are active without detonating them. In this example we will test whether an unknown operation is null (the identity) or an X gate, corresponding to a dud or a live bomb.\n",
    "\n",
    "### The Algorithm\n",
    "The algorithm will use two qubits, $q_1$ and $q_2$, as well as a small parameter, $\\epsilon = \\frac{\\pi}{n}$ for some integer $n$. Call the unknown gate, which is either the identity or an X gate, $G$, and assume we have it in a controlled form. The algorithm is then:\n",
    "1. Start with both $q_1$ and $q_2$ in the $|0\\rangle$ state\n",
    "2. Rotate $q_1$ by $\\epsilon$ about the Y axis\n",
    "3. Apply a controlled $G$ on $q_2$, conditioned on $q_1$\n",
    "4. Measure $q_2$\n",
    "5. Repeat (2-4) $n$ times\n",
    "6. Measure $q_1$\n",
    "\n",
    "![Algorithm Depiction](http://i.imgur.com/sG8Pa3J.jpg)\n",
    "\n",
    "### Explanation and proof of correctness\n",
    "There are two cases: Either the gate is the identity (a dud), or it is an X gate (a live bomb).\n",
    "#### Case 1: Dud\n",
    "After rotation, $q_1$ is now approximately\n",
    "$$q_1 \\approx |0\\rangle + \\frac{\\epsilon}{2} |1\\rangle$$\n",
    "Since the unknown gate is the identity, the controlled gate leaves the two qubit state separable,\n",
    "$$q_1 \\times q_2 \\approx (|0\\rangle + \\frac{\\epsilon}{2} |1\\rangle) \\times |0\\rangle$$\n",
    "and measurement is trivial (we will always measure $|0\\rangle$ for $q_2$).\n",
    "Repetition will not change this result - we will always keep separability and $q_2$ will remain in $|0\\rangle$.\n",
    "After n steps, $q_1$ will flip by $\\pi$ to $|1\\rangle$, and so measuring it will certainly yield $1$. Therefore, the output register for a dud bomb will read:\n",
    "$$000...01$$\n",
    "#### Case 2: Live\n",
    "Again, after rotation, $q_1$ is now approximately\n",
    "$$q_1 \\approx |0\\rangle + \\frac{\\epsilon}{2} |1\\rangle$$\n",
    "But, since the unknown gate is now an X gate, the combined state after $G$ is now\n",
    "$$q_1 \\times q_2 \\approx |00\\rangle + \\frac{\\epsilon}{2} |11\\rangle$$\n",
    "Measuring $q_2$ now might yield $1$, in which case we have \"measured\" the live bomb (obtained a result which differs from that of a dud) and it explodes. However, this only happens with a probability proportional to $\\epsilon^2$. In the vast majority of cases, we will measure $0$ and the entire system will collapse back to\n",
    "$$q_1 \\times q_2 = |00\\rangle$$\n",
    "After every step, the system will most likely return to the original state, and the final measurement of $q_1$ will yield $0$. Therefore, the most likely outcome of a live bomb is\n",
    "$$000...00$$\n",
    "which will identify a live bomb without ever \"measuring\" it. If we ever obtain a 1 in the bits preceding the final bit, we will have detonated the bomb, but this will only happen with probability of order\n",
    "$$P \\propto n \\epsilon^2 \\propto \\epsilon$$\n",
    "This probability may be made arbitrarily small at the cost of an arbitrarily long circuit."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Generating Random Bombs\n",
    "A test set must be generated to experiment on - this can be done by classical (pseudo)random number generation, but as long as we have access to a quantum computer we might as well take advantage of the ability to generate true randomness."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# useful additional packages \n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "import numpy as np\n",
    "from collections import Counter #Use this to convert results from list to dict for histogram\n",
    "\n",
    "# importing QISKit\n",
    "from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister\n",
    "from qiskit import execute, Aer, IBMQ\n",
    "from qiskit.providers.ibmq import least_busy\n",
    "from qiskit.tools.visualization import plot_histogram"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# To use IBMQ Quantum Experience\n",
    "IBMQ.load_accounts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We will generate a test set of 50 \"bombs\", and each \"bomb\" will be run through a 20-step measurement circuit. We set up the program as explained in previous examples."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Use local qasm simulator\n",
    "backend = Aer.get_backend('qasm_simulator')\n",
    "\n",
    "# Use the IBMQ Quantum Experience\n",
    "# backend = least_busy(IBMQ.backends())\n",
    "\n",
    "N = 50 # Number of bombs\n",
    "steps = 20 # Number of steps for the algorithm, limited by maximum circuit depth\n",
    "eps = np.pi / steps # Algorithm parameter, small\n",
    "\n",
    "# Prototype circuit for bomb generation\n",
    "q_gen = QuantumRegister(1, name='q_gen')\n",
    "c_gen = ClassicalRegister(1, name='c_gen')\n",
    "IFM_gen = QuantumCircuit(q_gen, c_gen, name='IFM_gen')\n",
    "\n",
    "# Prototype circuit for bomb measurement\n",
    "q = QuantumRegister(2, name='q')\n",
    "c = ClassicalRegister(steps+1, name='c')\n",
    "IFM_meas = QuantumCircuit(q, c, name='IFM_meas')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Generating a random bomb is achieved by simply applying a Hadamard gate to a $q_1$, which starts in $|0\\rangle$, and then measuring. This randomly gives a $0$ or $1$, each with equal probability. We run one such circuit for each bomb, since circuits are currently limited to a single measurement."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Quantum circuits to generate bombs\n",
    "qc = []\n",
    "circuits = [\"IFM_gen\"+str(i) for i in range(N)]\n",
    "# NB: Can't have more than one measurement per circuit\n",
    "for circuit in circuits:\n",
    "    IFM = QuantumCircuit(q_gen, c_gen, name=circuit)\n",
    "    IFM.h(q_gen[0]) #Turn the qubit into |0> + |1>\n",
    "    IFM.measure(q_gen[0], c_gen[0])\n",
    "    qc.append(IFM)\n",
    "_ = [i.qasm() for i in qc] # Suppress the output"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that, since we want to measure several discrete instances, we do *not* want to average over multiple shots. Averaging would yield partial bombs, but we assume bombs are discretely either live or dead."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAc0AAAFFCAYAAACOpraoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de5yWdZ3/8dfH4eAhQAYJBwmQQBaFaNQs0zys6c/s18nazCwrc900tc1t29r67Vpr7m/dDppZ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MMdnBNZl7Vt1VJ6kqHffaNFI+Z/GPfVjWwGJraocrp21cAT2Xmhr6uR1L33Gd3H0NTkqSSfOREkqSSDE1JkkoyNCVJKsnQlCSpJENTkqSSDE1Jkkr6/0WTEtWvYM/gAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result = execute(qc, backend=backend, shots=1).result() # Note that we only want one shot\n",
    "bombs = []\n",
    "for circuit in qc:\n",
    "    for key in result.get_counts(circuit): # Hack, there should only be one key, since there was only one shot\n",
    "        bombs.append(int(key))\n",
    "#print(', '.join(('Live' if bomb else 'Dud' for bomb in bombs))) # Uncomment to print out \"truth\" of bombs\n",
    "plot_histogram(Counter(('Live' if bomb else 'Dud' for bomb in bombs))) #Plotting bomb generation results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Testing the Bombs\n",
    "\n",
    "Here we implement the algorithm described above to measure the bombs. As with the generation of the bombs, it is currently impossible to take several measurements in a single circuit - therefore, it must be run on the simulator."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Use local qasm simulator\n",
    "backend = Aer.get_backend('qasm_simulator')\n",
    "\n",
    "qc = []\n",
    "circuits = [\"IFM_meas\"+str(i) for i in range(N)]\n",
    "#Creating one measurement circuit for each bomb\n",
    "for i in range(N):\n",
    "    bomb = bombs[i]\n",
    "    IFM = QuantumCircuit(q, c, name=circuits[i])\n",
    "    for step in range(steps):\n",
    "        IFM.ry(eps, q[0]) #First we rotate the control qubit by epsilon\n",
    "        if bomb: #If the bomb is live, the gate is a controlled X gate\n",
    "            IFM.cx(q[0],q[1])\n",
    "        #If the bomb is a dud, the gate is a controlled identity gate, which does nothing\n",
    "        IFM.measure(q[1], c[step]) #Now we measure to collapse the combined state\n",
    "    IFM.measure(q[0], c[steps])\n",
    "    qc.append(IFM)\n",
    "_ = [i.qasm() for i in qc] # Suppress the output\n",
    "result = execute(qc, backend=backend, shots=1, max_credits=5).result()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAc0AAAFoCAYAAAA1lKBAAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5xWdZ3//8dLfvkjUIYIB11E0viMv2gEzWJTDHXTtC3Xj7W5/e5jaaVb67q2Xyt1i/rgp6JaW3+0m1nm6q5WbpurEWwWkj8AWRQkEYSAkRARUX46vr5/nAsaxxk4gzNzXTPzuN9u143rep9znXldzOF6cs55n/c7MhNJkrR7e1W7AEmSegpDU5KkkgxNSZJKMjQlSSrJ0JQkqSRDU5KkkvpXu4BqGjZsWI4aNaraZUiSasjDDz/8dGYOb2tZnw7NUaNGMWPGjGqXIUmqIXV1dcvbW+bpWUmSSjI0JUkqydCUJKkkQ1OSpJIMTUmSSjI0JUkqydCUJKkkQ1OSpJIMTUmSSjI0JUkqydCUJKkkQ1OSpJIMTUmSSjI0JUkqydCUJKkkQ1OSpJIMTUmSSjI0JUkqydCUJKkkQ1OSpJIMTUmSSjI0JUkqydCUeqHp06dz/PHHM378eKZNm9buenfeeSd1dXXMmzcPgO3bt3PhhRcyceJE3vSmN/GNb3yjw9uUejNDU+plmpubufTSS7ntttuYPXs2t99+O4899tgr1tu4cSPXXXcd48eP39n205/+lK1btzJr1ixmzpzJjTfeyIoVK0pvU+rtDE2pl5kzZw6HHnooo0ePZuDAgZx99tncddddr1hvypQpXHzxxey999472yKCTZs28eKLL7JlyxYGDhzI4MGDS29T6u0MTamXaWpq4qCDDtr5euTIkTQ1Nb1snfnz57Nq1SpOO+20l7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xlVSpTkvoEQ7MHqRx51gNjgcnAacA44JHMPKaatUlSX2Bo1qiIeD1wCEUnoFfcgxkR+wIHAW8BFmbmg91coiT1OYZmjYqIz1MMvv44xa0lN2fmY9WtSpL6NkOzRlV6xv4v4GzgvRT3ad4P/AfwjczcUsXyJKlPMjR7gMp0YOOB8ygCdDhwAcWgB7e0nIxaktR1DM0aFBFHA02Z+XSr9r2AIcDzwE+A8ZlZX4USJalPMjRrTEQMAe4FHgJ+SzFf5uLM3NRqvf2B/RzQQJK6j6FZYypD4p0GfBR4I7AaeLDymJuZv6tieZLUpxmaNaxyNHkm8AmKmU0+TzFF2InAnMxcU8XyJKnPMTR7iIgYTXEt893APwLvzcwfV7MmSeprDM0eptIZqBF4IjOfrXY9ktSXGJqSJJXkLCeSJJVkaEqSVJKhKUlSSYamJEklGZqSJJVkaEqSVNL/D7eVsYtwSZeOAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 504x360 with 1 Axes>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def get_status(counts):\n",
    "    # Return whether a bomb was a dud, was live but detonated, or was live and undetonated\n",
    "    # Note that registers are returned in reversed order\n",
    "    for key in counts:\n",
    "        if '1' in key[1:]:\n",
    "             #If we ever measure a '1' from the measurement qubit (q1), the bomb was measured and will detonate\n",
    "            return '!!BOOM!!'\n",
    "        elif key[0] == '1':\n",
    "            #If the control qubit (q0) was rotated to '1', the state never entangled because the bomb was a dud\n",
    "            return 'Dud'\n",
    "        else:\n",
    "            #If we only measured '0' for both the control and measurement qubit, the bomb was live but never set off\n",
    "            return 'Live'\n",
    "\n",
    "results = {'Live': 0, 'Dud': 0, \"!!BOOM!!\": 0}\n",
    "for circuit in qc:\n",
    "    status = get_status(result.get_counts(circuit))\n",
    "    results[status] += 1\n",
    "plot_histogram(results)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
